﻿<?php 
require_once '../../includefiles.php';
include_once("../../model/users.php");
require_once '../../model/testimonials.php';


// create object
$testimonialObj = new Model_Testimonial();
$userObj = new Model_Users();

checkUserLogin();

if(isset($_POST['submit']))
{
	extract($_POST);	

		if(trim($_POST['description'])!='')
		{
			/*		echo "<pre>";print_r($_POST);exit;*/
		
			$addTestimonial                = array();
			$addTestimonial['user_id']     = $_SESSION['getbids_id'];
			$addTestimonial['description'] = html_entity_decode($_POST['description']);
			$addTestimonial['status']      = '0';				
			$addTestimonial['added_date']  = date("Y-m-d H:m:s");	
			$testimonialObj->add_Testimonial($addTestimonial);
			$_SESSION['msg']="<div class='success_msg'style='margin-top:5px;margin-bottom: 20px;'><span>Testimonial added successfully!</span></div>";				
		}
	redirect_to_link(SITE_URL."/testimonials/mytestimonials/");
	exit;
} 
?>
<script type="application/javascript"  src="<?php echo SITE_URL; ?>/includes/js/add_testimonial.js" ></script>


  <div class="popupcontain">
   <form name="add_forum" id="add_testimonial"  method="POST" onSubmit="return validateBuylead();" action="<?php echo SITE_URL; ?>/modules/testimonials/addtestimonial.php" >   
   
   		<table cellpadding="5" cellspacing="0" width="500px;">
        	<tr>
            	<td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
        
        	<tr>
            	<td valign="top" align="right"><b>Testimonial</b> :</td>
                <td><textarea name="description" id="description" rows="10" cols="80" class="tarea" style="width:300px;height:150px;resize:none;" onKeyDown="limitText(this.form.description,this.form.countdown,300);" onKeyUp="limitText(this.form.description,this.form.countdown,300);"></textarea> <!-- {$testimonialArray.description}--><br /><font size="1">(Maximum characters: 300)<br>
	            You have <input readonly type="text" name="countdown" size="3" value="300" > characters left.</font>
                <div id="err_description" ></div></td>
            </tr>
            <tr>
            	<td colspan="2" align="center"><input type="submit" name="submit" value="Submit" class="btn"></td>
            </tr>
        </table>
   </form>  
   <div class="clear"></div>
  </div> 
